import { defineStore } from 'pinia'
type User1 = {
    name:string
    age: number
}  
let result:User1 = {
    name:'p',
    age: 18
}
const login = ():Promise<User1> =>{
    return new Promise((resolve)=>{
        setTimeout(() => {
            resolve(result)
        }, 2000);
      
    })
}
export const userTest = defineStore({
    id:'test-vue',
    state:()=>{
        return {
            name:'Qi',
            content:1,
            user:<User1>{

            }
        }
    },
    actions:{
        async emitUser(num:number,name:string){
           this.user = await login()
            // this.name =name
            // this.content = num
            // this.user = result
        }
    },
    persist: true,
})